//
//  StackClass.cpp
//  Practice10
//
//  Created by 赵世杰 on 2020/7/25.
//  Copyright © 2020 zhaoshijie. All rights reserved.
//

#include "StackClass.hpp"


Stack :: Stack()
{
    top = 0;
}

bool Stack::isempty() const
{
    return top == 0;
}

bool Stack::isfull() const
{
    return top == MAX;
}

bool Stack::push(const Item &item)
{
    if(top < MAX)
    {
        items[top++] = item;
        return true;
    }
    else
    {
        return false;
    }
}

bool Stack::pop(Item &item)
{
    if(top>0)
    {
        item = items[--top];
        return true;
        
    }
    else
    {
        return false;
    }
}


